Page({
  data: {
    privacySettings: {
      profileVisible: true,
      locationVisible: false,
      searchable: true,
      allowMessage: true,
      allowFollow: true,
      showOnlineStatus: false
    }
  },

  // 切换隐私设置
  onToggleSetting(e) {
    const { field } = e.currentTarget.dataset;
    const { value } = e.detail;
    
    this.setData({
      [`privacySettings.${field}`]: value
    });

    wx.showToast({
      title: value ? '已开启' : '已关闭',
      icon: 'success'
    });
  },

  // 保存设置
  onSaveSettings() {
    wx.showLoading({
      title: '保存中...'
    });

    setTimeout(() => {
      wx.hideLoading();
      wx.showToast({
        title: '设置已保存',
        icon: 'success'
      });
      
      setTimeout(() => {
        wx.navigateBack();
      }, 1000);
    }, 1000);
  }
}); 